package com.android.killtencent.activity;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.android.killtencent.R;
import com.android.killtencent.utils.AppManager;
import com.android.pc.ioc.inject.InjectInit;

public class BaseActivity extends ActionBarActivity {
    //所有输入框为空时执行的动画
    private Animation animation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AppManager.getAppManager().addActivity(this);
        System.out.print("");
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        AppManager.getAppManager().finishActivity();
    }

    @InjectInit
    private void initAnimation() {
        animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shake);
    }

    /**
     * 开启抖动动画  所有继承该activity的类均能调用
     *
     * @param view 需要抖动动画的控件View
     */
    public void startAnimation(View view) {
        if (animation != null) {
            view.startAnimation(animation);
        }
    }
}
